Skip to content

Paginate burgs, states, cultures, religions, rivers & routes editors#1469

Open
barrulus wants to merge 1 commit into
Azgaar:masterfrom
barrulus:feat/editor-pagination-upstream
Open

Paginate burgs, states, cultures, religions, rivers & routes editors#1469
barrulus wants to merge 1 commit into
Azgaar:masterfrom
barrulus:feat/editor-pagination-upstream

Conversation

@barrulus

@barrulus barrulus commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Renders large editor lists 200 rows at a time so they stay responsive on big maps. The States editor in particular was effectively unusable at 1k+ states because it renders a coat-of-arms per row; it now renders the COA only for the current page.

What changed

  • Shared pagination/sort helpers in editors.js: getActiveSort, sortDataByActiveHeader, getEditorPage, renderEditorPagination, bindEditorSortReset.
  • Pagination added to the Burgs, States, Cultures, Religions, Rivers, and Routes overviews/editors.
  • Each one sorts the full filtered set (so sorting spans all pages, an upgrade over the old DOM-only applySorting), computes footer totals/averages over the full set, then renders only the current page and draws Page n of N controls in the footer.
  • CSV exports operate over the full set (some previously read the rendered DOM, which would now be only the visible page).
  • Search and state/culture filters (burgs) and column sort reset to page 1 and filter/sort across all pages; lazily-computed route name/length are populated for the full set so sort/footer/CSV stay correct.
  • Manual re-assignment map-clicks, the culture-center hover, and randomizeStatesExpansion are guarded against rows that aren't on the current page.
  • The footer pager fills the table-driven width without contributing to the dialog's fit-content width, so narrow dialogs (e.g. Rivers) don't get an empty gutter.

Notes

  • No new HTML or CSS — the pager UI is created entirely in JS (page size 200).
  • Seven files touched; all were identical to current master before this change.

Test plan

  • Open each editor on a 1k+ map: paginates at 200; prev/next/jump/clamp work; pager hidden when the list fits one page.
  • Column sort resets to page 1 and orders the full set (top of page 1 is the global max/min).
  • Footer totals/averages stable across pages; percentage mode (states/cultures/religions) correct on a later page.
  • Burgs: state/culture filters + search reset to page 1 and apply across all pages; "regenerate names" applies to the full filtered set.
  • CSV export from a non-first page contains all rows.
  • States manual re-assignment + randomize produce no console errors.

@inviktos

inviktos commented Jun 9, 2026

Copy link
Copy Markdown

Much needed changes for maps with complex and large numbers of states.Greatly aids performance and quality!

Render large editor lists 200 rows at a time so they stay responsive on big
maps; the States editor in particular was effectively unusable at 1k+ states
because it renders a coat-of-arms per row.

- Shared pagination/sort helpers in editors.js (getActiveSort,
  sortDataByActiveHeader, getEditorPage, renderEditorPagination,
  bindEditorSortReset).
- Sorting, footer totals/averages and CSV export operate over the full
  filtered set; only the current page is rendered and gets row listeners /
  COA renders.
- Search and state/culture filters (burgs) and column sort reset to page 1;
  pager hidden when the list fits on one page.
- The footer pager fills the table width without widening the fit-content
  dialog. No new HTML/CSS; the pager UI is built in JS.
@barrulus barrulus changed the title Paginate states, cultures, religions, rivers & routes editors Paginate burgs, states, cultures, religions, rivers & routes editors Jun 9, 2026
@barrulus barrulus force-pushed the feat/editor-pagination-upstream branch from f5926b4 to f8045f0 Compare June 9, 2026 18:35
@Azgaar Azgaar self-requested a review June 9, 2026 18:45
@Azgaar

Azgaar commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Good idea, but I don't like the code, has to be "un-vibed". editors.js is ancient, probably would need to refactor it first to reduce the entropy.

@netlify

netlify Bot commented Jun 9, 2026

Copy link
Copy Markdown

Deploy Preview for afmg ready!

Name Link
🔨 Latest commit f5926b4
🔍 Latest deploy log https://app.netlify.com/projects/afmg/deploys/6a285acfff117b0008a394ca
😎 Deploy Preview https://deploy-preview-1469--afmg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@barrulus

barrulus commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Good idea, but I don't like the code, has to be "un-vibed". editors.js is ancient, probably would need to refactor it first to reduce the entropy.

Use the idea, don't use the code

@netlify

netlify Bot commented Jun 9, 2026

Copy link
Copy Markdown

Deploy Preview for afmg ready!

Name Link
🔨 Latest commit f8045f0
🔍 Latest deploy log https://app.netlify.com/projects/afmg/deploys/6a285cfab20365000841e6f8
😎 Deploy Preview https://deploy-preview-1469--afmg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants